<?php

namespace app\common\model;

use app\common\validate\SystemValidate;
use think\Model;
use think\model\concern\SoftDelete;

class System extends Model
{
    // 软删除
    use SoftDelete;

    // 修改网站信息
    public function set($data)
    {
        $validate = new SystemValidate();
        if (!$validate->scene('set')->check($data)){
            return $validate->getError();
        }
        $info = $this->find($data['id']);
        $info->webname = $data['webname'];
        $info->copyright = $data['copyright'];
        $result = $info->save();
        if ($result){
            return 1;
        }else{
            return '设置失败';
        }
    }

}
